package 代码随想录.字符串.左旋转字符串;

/**lc：剑指 Offer 58 - II. 左旋转字符串
 * link：https://leetcode-cn.com/problems/zuo-xuan-zhuan-zi-fu-chuan-lcof/
 * @author ChenweiLin
 * @create 2021-12-24 10:20
 */
public class ZuoXuanZhuanZiFuChuanIcof {
    public static void main(String[] args) {
        String s =  "lrloseumgh";
        System.out.println(reverseLeftWords(s, 6));
    }

    public static String reverseLeftWords(String s, int n) {
        StringBuilder result = new StringBuilder();
        String s1 = s.substring(0, n);
        String s2 = s.substring(n, s.length());
        result.append(s2);
        result.append(s1);

        return new String(result);
    }
}
